package learning.exercise;

import java.util.Random;

public class Ex1 {
	public static void main(String[] args) {
		Pass p=new Pass();
		Random sc=new Random();
		for (int i = 0; i <10; i++) {
			new Thread(p,String.valueOf(sc.nextInt())).start();
		}
	}

}
class Pass implements Runnable{
//    private String name;
//    
//	public Pass(String name) {
//		super();
//		this.name = name;
//	}

	@Override
	public void run() {
		synchronized (String.class) {
			System.out.println(Thread.currentThread().getName() +" is passing in the trace");
			try {
				Thread.sleep(5000);
				System.out.println(Thread.currentThread().getName() +" has passed the trace");
			} catch (Exception e) {
				e.printStackTrace();
			}
			
		}
	}
	
}			